//
//  AlertTool.swift
//  Intersection
//
//  Created by 我骑着蜗牛走天下 on 2025/3/6.
//

import UIKit

@MainActor
public class AlertTool {
    
    ///系统底部弹窗
    public static func showAlertSheet(title:String ,message: String = "" ,actionTitleArr:Array<String> ,block: @escaping (_ index: Int) -> Void ){
        
        let alert = UIAlertController(title: title, message: message, preferredStyle: .actionSheet)
        let canceAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
        
        for i in 0...actionTitleArr.count-1 {
            
            let Action = UIAlertAction(title: actionTitleArr[i], style: .default) { (action) in
                
                block(i)
                
            }
            
            alert.addAction(Action)
        }
        
        alert.addAction(canceAction)
        
        getCurrentVC.present(alert, animated: true, completion: nil)
        
    }
    
}
